# -*- coding: utf-8 -*-#
#-------------------------------------------------------------------------------
# 建立者:        黄周云  
# Name:         test04
# Description:  例7.3
# Author:       ASUS
# Date:         2019/3/7
#-------------------------------------------------------------------------------


data = {}
# 初始化字典data和key的值
data["d"] = {}
data["names"] = []
data["products"] =[]
# 从控制台输入key的值
print("请输入字典数据，key和value之间用逗号分隔")
dictStr = input(":")
list = dictStr.split(",")
keys = []
values = []
for i in range(len(list)):
    if i%2==0:
        keys.append(list[i])
    else:
        values.append(list[i])
data["d"].update(dict(zip(keys,values)))
# 从控制台输入key为names的值
print("请输入姓名，多个姓名之间用逗号隔开")
nameStr = input(":")
names = nameStr.split(",")
data["names"].extend(names)
# 从控制台输入key为products的值
print("请输入产品，多个产品之间用逗号隔开")
productStr = input(":")
products = productStr.split(",")
data["products"].extend(products)
# 输出字典data中的数据
for key in data.keys():
    print(key,":",data[key])



